package com.apiit.webserviceclient.activities;

import com.apiit.webserviceclient.R;
import com.apiit.webserviceclient.R.layout;
import com.apiit.webserviceclient.R.menu;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;

public class ViewCurrentlyAssignedStudents extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_view_currently_assigned_students);
		
		Intent intename = getIntent();
		String []value = intename.getStringArrayExtra("value");
		TableLayout table = (TableLayout) findViewById(R.id.tableLayouttest);
		
		for(int i=1;i<value.length-11;i++)
		{
		    TableRow row=new TableRow(this);
		    String StudentID = value[i].trim();
		    String Name = value[i+1].trim();
		    String Supervisor = value[i+2].trim();
		    String ProjectTitle = value[i+3].trim();
		    String PPF = value[i+4].trim();
		    String PSF = value[i+5].trim();
		    String MID = value[i+6].trim();
		    String oneToSix = value[i+7].trim();
		    String oneToSeven = value[i+8].trim();
		    String LastSeen = value[i+9].trim();
		    String Submission = value[i+10].trim();
		    
		    TextView IDvalue=new TextView(this);
		    IDvalue.setText(""+StudentID +"\t");
		    IDvalue.setTextSize(14);
		   
		    TextView namevalue=new TextView(this);
		    namevalue.setText(""+Name+"\t");
		    namevalue.setTextSize(14);
		    
		    TextView supvalue=new TextView(this);
		    supvalue.setText(""+Supervisor +"\t");
		    supvalue.setTextSize(14);
		   
		    TextView titlevalue=new TextView(this);
		    titlevalue.setText(""+ProjectTitle+"\t");
		    titlevalue.setTextSize(14);
		    
		    TextView ppfvalue=new TextView(this);
		    ppfvalue.setText(""+PPF +"\t");
		    ppfvalue.setTextSize(14);
		   
		    TextView psfvalue=new TextView(this);
		    psfvalue.setText(""+PSF+"\t");
		    psfvalue.setTextSize(14);
		    
		    TextView midvalue=new TextView(this);
		    midvalue.setText(""+MID +"\t");
		    midvalue.setTextSize(14);
		   
		    TextView oneToSixvalue=new TextView(this);
		    oneToSixvalue.setText(""+oneToSix+"\t");
		    oneToSixvalue.setTextSize(14);
		    
		    TextView oneToSevenvalue=new TextView(this);
		    oneToSevenvalue.setText(""+oneToSeven+"\t");
		    oneToSevenvalue.setTextSize(14);
		    
		    TextView LastSeenDatevalue=new TextView(this);
		    LastSeenDatevalue.setText(""+LastSeen+"\t");
		    LastSeenDatevalue.setTextSize(14);
		    
		    TextView Submissionvalue=new TextView(this);
		    Submissionvalue.setText(""+Submission+"\n");
		    Submissionvalue.setTextSize(14);
		    
		    row.addView(IDvalue);
		    row.addView(namevalue);
		    row.addView(supvalue);
		    row.addView(titlevalue);
		    row.addView(ppfvalue);
		    row.addView(psfvalue);
		    row.addView(midvalue);
		    row.addView(oneToSixvalue);
		    row.addView(oneToSevenvalue);
		    row.addView(LastSeenDatevalue);
		    row.addView(Submissionvalue);
		    table.addView(row);
		    i= i+10;
		}
	}


	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater()
				.inflate(R.menu.view_currently_assigned_students, menu);
		return true;
	}

}
